<template>
	<view class="flex" :style="'font-size:'+size+'rpx'">
		{{isHidden?hiddenStr:text}}
		<view @tap="change" v-if="isHidden" class='text-gray margin-left-sm cuIcon-attentionforbid'></view>
		<view @tap="change" v-if="!isHidden" class='text-gray margin-left-sm cuIcon-attention'></view>
		<view @tap="copy" class='text-gray margin-left cuIcon-copy'></view>
	</view>
</template>

<script>
	export default {
		name:"forbidden",
		props: {
			text:{
				type:String,
				default:''
			},
			size:{
				type:Number,
				default:12
			}
		},
		data() {
			return {
				isHidden:true,
				hiddenStr:'*'
			};
		},
		created() {
			let str=""
			for(let i=0;i<this.text.length*1.5;i++){
				str=str+'*'
			}
			this.hiddenStr=str
		},
		methods:{
			change(){
				this.isHidden=!this.isHidden
				this.$emit('hide',this.isHidden)
			},
			copy(){
				uni.setClipboardData({
					data:this.text
				})
			}
		}
	}
</script>

<style>

</style>